<?php
/**
 * User: aka
 * Time: 13:28
 */

namespace app\input\controller;

use app\validator\chatRoom\InputChatRoom;
use think\facade\Session;
use think\Request;

class ChatRoom
{
    public function inputChatRoom(Request $request)
    {
        $validate = new InputChatRoom();
        if (!$validate->check($request->param())) {
            return json($validate->getError());
        }else {
            $addData = array();
            $addData['chat_content'] = $request->param('chat_content');
            $addData['user_id'] = Session::get('user_info.user_id');
            $addData['ip'] = $request->ip();
            \app\secret\model\ChatRoom::create($addData);
            return json(200);
        }
    }
}